<template class="index_background">
  <div>
    <el-collapse>
      <div class="divcss5" style="border-bottom:3px solid #eee">
      <h5 align="left">我的简历>在线简历</h5>

      <el-row>
      <router-link to='editonlineCV'>
       <el-button type="primary"  style="float: right; margin-right:100px; margin-top: -30px;">添加简历</el-button>
      </router-link>
      </el-row>

      </div>
        <el-table :data="cvRecord">
          <template v-for="item in tableLabel">
            <el-table-column
              :key="index"
              :prop="item.prop"
              :label="item.label"
              :width="item.width"
              :align="item.align">
            </el-table-column>
<!--          -->
<!--        <el-table-column prop="CVname" label="简历名称" width="300" align="center">-->
<!--        </el-table-column>-->
<!--        <el-table-column prop="date" label="最新保存时间" width="300" align="center">-->
<!--        </el-table-column>-->
          </template>
       <el-table-column label="操作" width="300" align="center">
        <template slot-scope="scope" >
        <router-link to='editonlineCV'>
        <el-button
          size="mini"
          @click="handleLook(scope.$index, scope.row)">查看或编辑</el-button>
        </router-link>
        <el-button
          size="mini"
          type="danger"
          @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    </el-collapse>
    </div>
</template>

<style>
.divcss5{
  margin:30px 0;
  color: rgb(144,144,144);
  height: 100px;
}
.index_background{
   background:white;
   }
  .lable{
    color: rgb(144,144,144);
    margin-top:30px;
    margin-bottom:30px;
  }
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }

  .el-aside {
    color: #333;
  }
</style>

<script>
  import fetch from '../api/fetch'
export default {
  data () {
    return {
      cvRecord: [],
      tableLabel:[
        {prop:"CVname", label:"简历名称",width:"300",align:"center"},
        {prop:"date", label:"最新保存时间",width:"300",align:"center"},
      ]
    }
  },
  mounted() {
    // var obj = {pageNum: 1, pageSize: 10, StuCv: {sid: 111}}
    var obj = {pageNum: 1, pageSize: 10, StuCv: {sid: sessionStorage.getItem('userId')}}
    console.log(obj)
    this.getCVonline(obj)
  },
  methods: {
    getCVonline (obj) {
      fetch.getOnlineCV(obj).then(res => {
        console.log(res.data)
        for (var i=0; i<res.data.rows.length; i++)
        {
          this.cvRecord.push({
            CVname: res.data.rows[i].StuCv.cvid,
            date: res.data.rows[i].StuInfo.registTime
          })
        }
        }
      )
    },
    handleLook (index, row) {
      console.log(index, row);
    },
    handleDelete (index, row) {
      console.log(index, row);
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    }
  }
}
</script>
